package cn.com.api.mapper.base;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import com.sdicons.json.validator.impl.predicates.True;

import cn.com.api.entity.ApiU_resource;

//DAO
public interface U_resourceMapperBase {

	// 根据id查看
	@Select("SELECT * FROM U_RESOURCE  WHERE RESOURCE_ID = #{id}")
	public ApiU_resource findU_resourceById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_resource")
	public List<ApiU_resource> findU_resources();

	// 根据条件查看数据集
	public List<Map<String, Object>> findU_resourcesByMap(HashMap condition);

	// 添加
	@Insert("INSERT INTO U_RESOURCE (RES_NAME, RES_URL, CREATE_TIME, CREATE_BY, STATUS, RES_SIZE, RES_IMAGE, EXT_1, EXT_2, EXT_3, EXT_4, EXT_5, TYPE) VALUES (#{res_name}, #{res_url}, #{create_time}, #{create_by}, #{status}, #{res_size}, #{res_image}, #{ext_1}, #{ext_2}, #{ext_3}, #{ext_4}, #{ext_5}, #{type})")
	@Options(useGeneratedKeys = true, keyProperty = "resource_id")
	public int insertU_resource(ApiU_resource u_resource);

	// 修改
	@Update("UPDATE U_RESOURCE SET RES_NAME = #{res_name}, RES_URL = #{res_url}, CREATE_TIME = #{create_time}, CREATE_BY = #{create_by}, STATUS = #{status}, RES_SIZE = #{res_size}, RES_IMAGE = #{res_image}, EXT_1 = #{ext_1}, EXT_2 = #{ext_2}, EXT_3 = #{ext_3}, EXT_4 = #{ext_4}, EXT_5 = #{ext_5}, TYPE = #{type} WHERE RESOURCE_ID = #{resource_id}")
	public int updateU_resource(ApiU_resource u_resource);

	// 删除
	@Delete("DELETE FROM U_RESOURCE  WHERE RESOURCE_ID = #{resource_id}")
	public int deleteU_resource(Integer resource_id);

	// Foreign keys revelant

	// region Indexs revelant

}
